package com.ncloud.crm.utils;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Created by shiqiang on 2017/7/6.
 */
public class MsgBoxUtil {
    private final org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
    public static String geneBoxMessage(String srcStr, JSONObject data){
        final String head ="${";
        final String fooled = "}";
        for (Map.Entry<String, Object> entry : data.entrySet()) {
            StringBuffer sb = new StringBuffer(head);
            sb.append(entry.getKey()).append(fooled);
            srcStr = srcStr.replace(sb.toString(),entry.getValue().toString());
        }
        return srcStr;
    }
}
